package userInterface;

import java.awt.BorderLayout;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

import javax.swing.JPanel;

public class RootView extends JPanel
{
	public RootView(DrawingModel model)
	{
		this.setName("RootView");
		
		// create the views
		_drawView = new DrawingView(model);
		_leftView = new LeftPalleteView();
	
		// add the views
		this.setLayout(new BorderLayout());
		this.add(_leftView, BorderLayout.WEST);
		this.add(_drawView);
	}

	@Override
	public synchronized void addMouseListener(MouseListener l)
	{
		super.addMouseListener(l);
		
		// add mouse listener to children
		_drawView.addMouseListener(l);
		_leftView.addMouseListener(l);
	}
	

	@Override
	public synchronized void addMouseMotionListener(MouseMotionListener l)
	{
		super.addMouseMotionListener(l);
		
		// add mouse listener to children
		_drawView.addMouseMotionListener(l);
	}

	public DrawingView getDrawView()
	{
		return _drawView;
	}
	
	public LeftPalleteView getLeftPalleteView()
	{
		return _leftView;
	}
	
	public LeftPalleteView getLeftView()
	{
		return _leftView;
	}
	
	private DrawingView _drawView;
	private LeftPalleteView _leftView;
}
